package com.handong.handserialprogram.utils;

import org.greenrobot.eventbus.EventBus;

/**
 * Created by userKey on 2017/4/15.
 */

public class EventBusUtil {

    private EventBusUtil(){}

    public static boolean isRegister(Object object){
        return EventBus.getDefault().isRegistered(object);
    }

    public static void register(Object object){
        if(!EventBus.getDefault().isRegistered(object)){
            EventBus.getDefault().register(object);
        }

    }

    public static void post(Object obj){
        EventBus.getDefault().post(obj);
    }

    public static void unRegister(Object object){
        if(EventBus.getDefault().isRegistered(object)){
            EventBus.getDefault().unregister(object);
        }

    }
}
